package com.shelpe.services.algorithm.development;

import java.util.ArrayList;
import java.util.List;

import com.shelpe.services.algorithm.client.RankClient;
import com.shelpe.services.algorithm.entity.batis.Keyword;
import com.shelpe.services.algorithm.entity.jpa.DevelopmentKeyword;
import com.shelpe.services.algorithm.entity.jpa.DevelopmentPlan;

import lombok.Data;

@Data
public class DevelopmentSustainer {

	private DevelopmentPlan plan;
	private List<DevelopmentKeyword> targets;
	private List<Keyword> keywords;

	private String nick;
	private long productID;

	private List<RankClient.KeywordRealtimeRankItem> ranks = new ArrayList<RankClient.KeywordRealtimeRankItem>();

	public RankClient.KeywordRealtimeRankItem findRank(long keywordID) {
		for (RankClient.KeywordRealtimeRankItem rank : this.ranks) {
			if (rank.getKeywordID() == keywordID) {
				return rank;
			}
		}
		return null;
	}
	
	public Keyword findKeyword(long keywordID) {
		for (Keyword kw : this.keywords) {
			if (kw.getKeywordId()== keywordID) {
				return kw;
			}
		}
		return null;
	}
}
